from apscheduler.schedulers.blocking import BlockingScheduler
from datetime import datetime

def tick():
    print('Current time is %s' % datetime.now())

if __name__ == "__main__":
    scheduler = BlockingScheduler()
    scheduler.add_job(tick,'cron',minute="*/1")

    try:
        scheduler.start()
    except (KeyboardInterrupt,SystemExit):
        print("程序退出")